<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>

    //使用while循环制作4×4的表格
    var x = 0;
    var y = 0;
    document.write("<table border='1' height='400' width='400'>");

    while(x < 4){
        document.write("<tr>");
        y=0;
        console.log("x值为" + x)
        while(y < 4){
            console.log("y的值为" + y);
            document.write("<td>");
            document.write("&nbsp;&nbsp;");
            document.write("</td>");
            y++; 
        }
        document.write("</tr>")
        x++;
        
    }
    document.write("</table>");
</script>
</html>